﻿using System;
using System.Runtime.Serialization;
using System.Xml.Linq;

namespace NCMIS.ObjectModel.MetaData
{
    [DataContract(Name = "choiceString", Namespace = CmisNs.Cmis)]
    public class CmisChoiceString : CmisChoice
    {
        [DataMember(Name = "value")]
        public string[] Value
        {
            get;
            set;
        }

        [DataMember(Name = "choice")]
        public CmisChoiceString[] Choice
        {
            get;
            set;
        }

        public override XElement ToXElement()
        {
            XElement result = new XElement(CmisNs.XCmis + "choiceString",
                new XAttribute("displayName", this.DisplayName),
                new XAttribute("value", this.Value.ToString()));
            foreach (CmisChoiceString choice in this.Choice)
            {
                result.Add(choice.ToXElement());
            }
            return result;
        }
    }
}
